<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../template/taglib.jsp"%>
<jsp:include page="../template/header.jsp" />

<jsp:include page="../template/staffmenu.jsp" />

<%-- content template --%>
<jsp:include page="../template/contentheader.jsp" />
<%-- put content here --%>
<link rel="stylesheet" href="/LeaveApplicationProcessingSystem/calendar/zapatec/zpcal/themes/winter.css" />
<link href="/LeaveApplicationProcessingSystem/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript"
	src="/LeaveApplicationProcessingSystem/calendar/zapatec/zpcal/utils/zapatec.js"></script>
<script type="text/javascript"
	src="/LeaveApplicationProcessingSystem/calendar/zapatec/zpcal/src/calendar.js"></script>
<script type="text/javascript"
	src="/LeaveApplicationProcessingSystem/calendar/zapatec/zpcal/lang/calendar-en.js"></script>

<fmt:setBundle basename="staff" />
<c:set var="t" value="true" />
<form action="/LeaveApplicationProcessingSystem/StaffLeaveApplyServlet"
	method="post">
	<h1>
		<fmt:message key="leave.apply.title" />
	</h1>
	<table>
		<tr>
			<td class="inner">
				<table>
					<tr>
						<td>&nbsp;</td>
						<td><c:if test="${param['apply']==t}">
								<input type="hidden" name="ins" value="true" />
							</c:if> <c:if test="${param['update']==t}">
								<input type="hidden" name="ins" value="false" />
								<input type="hidden" name="id" value="${param.id}" />
							</c:if></td>
					</tr>
					<tr>
						<td><fmt:message key="label.apply.leavetype" /></td>
						<td><select name="leaveType">
								<c:forEach var="leavetype" items="${leaveTypes}">
									<option value="${leavetype.id}">
										<c:out value="${leavetype.name}" />
									</option>
								</c:forEach>
								<c:if test="${empty leaveTypes}">
									<option value="0" <c:if test="${param.leaveType == 0}">SELECTED</c:if>>Choose Leave Type</option>
									<option value="1" <c:if test="${param.leaveType == 1}">SELECTED</c:if>>Annual Leave</option>
									<option value="2" <c:if test="${param.leaveType == 2}">SELECTED</c:if>>Medical Leave</option>
									<option value="3" <c:if test="${param.leaveType == 3}">SELECTED</c:if>>Compensation Leave</option>
								</c:if>
						</select></td>
					</tr>
					<tr>
						<td><fmt:message key="label.apply.leavenature" /></td>
						<td><select name="natureOfLeave">
								<c:forEach var="natureOfLeave" items="${natureOfLeaves}">
									<option value="${natureOfLeave.id}">
										<c:out value="${natureOfLeave.name}" />
									</option>
								</c:forEach>
								<c:if test="${empty natureOfLeaves}">
									<option value="0" <c:if test="${param.natureOfLeave == 0}">SELECTED</c:if>>Choose Nature Of Leave</option>
									<option value="1" <c:if test="${param.natureOfLeave == 1}">SELECTED</c:if>>Overseas</option>
									<option value="2" <c:if test="${param.natureOfLeave == 2}">SELECTED</c:if>>Pregnant</option>
									<option value="3" <c:if test="${param.natureOfLeave == 3}">SELECTED</c:if>>Education</option>
								</c:if>
						</select></td>
					</tr>
					<tr>
						<td><fmt:message key="label.apply.sDate" /></td>
						<td><input type="text" name="startDate"
							value="${param['startDate']}" id="calendar1" maxlength="400"
							size="15" style="background-color: rgb(255, 255, 160);"
							readonly="readonly" />
							<button id="trigger1">...</button> <script type="text/javascript">
								//
								Zapatec.Calendar.setup({
									firstDay : 1,
									electric : false,
									inputField : "calendar1",
									button : "trigger1",
									ifFormat : "%Y-%m-%d",
									daFormat : "%Y-%m-%d"
								});
								//
							</script></td>
					</tr>
					<tr>
						<td><fmt:message key="label.apply.eDate" /></td>
						<td><input type="text" name="endDate"
							value="${param['endDate']}" id="calendar2" maxlength="400"
							size="15" style="background-color: rgb(255, 255, 160);"
							readonly="readonly" />
							<button id="trigger2">...</button> <script type="text/javascript">
								//         
								Zapatec.Calendar.setup({
									firstDay : 1,
									electric : false,
									inputField : "calendar2",
									button : "trigger2",
									ifFormat : "%Y-%m-%d",
									daFormat : "%Y-%m-%d"
								});
								//
							</script></td>
					</tr>
					<tr>
						<td><fmt:message key="label.apply.reason" /></td>
						<td><input type="text" name="reason"
							value="${param['reason']}" size="30" /></td>
					</tr>
					<tr>
						<td><fmt:message key="label.apply.workdissemenation" /></td>
						<td><input type="text" name="workDisemmination"
							value="${param['workDisemmination']}" size="30" /></td>
					</tr>
					<tr>
						<td><fmt:message key="label.apply.contact" /></td>
						<td><input type="text" name="contactDetails"
							value="${param['contactDetails']}" size="30" /></td>
					</tr>
					<%-- <c:if test="${param['update']==t}">
						<tr>
							<td><fmt:message key="label.apply.totalovertime" /></td>
							<td><input type="text" name="totalOvertime"
								value="${param['totalOvertime']}" size="30" readonly="readonly" />
							</td>
						</tr>
					</c:if> --%>
					<tr>
						<td><fmt:message key="label.apply.latestovertime" /></td>
						<td><input type="text" name="overTime"
							value="${param['overTime']}" size="30" /></td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td>
						<c:out value="${dateErrMsg}" />
						<c:out value="${leaveTypeErrMsg}" />
						<c:out value="${overTimeErrMsg}" />
						<c:out value="${dateCompareErrMsg}" />
						</td>
					</tr>
					<tr>
						<td colspan="2" align="center"><input type="submit"
							value="Apply" name="btnApply" /> <input type="reset"
							value="Clear" name="btnClear" /></td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</form>
<jsp:include page="../template/contentfooter.jsp" />
<%-- end of content template --%>

<jsp:include page="../template/footer.jsp" />